//**如何将某些固有逻辑，使得他们实现多个纬度的变化
//将业务功能与平台实现分离，是的他们可以独立的变化

class Messager
{
protected:
	MessagerImp* messagerImp;
public:
	virtual void Login(string username, string password) = 0;
	virtual void sendMessage(string message) = 0;
	virtual void sendPicture(Image image) = 0;

	virtual ~Messager(){}
};

class MessageImp
{
public:
	virtual void PlaySound() = 0;
	virtual void DrawShape() = 0;
	virtual void WriteText() = 0;
	virtual void Connect() = 0;

	virtual MessagerImp(){}
};

//平台实现
class PCMessageImp: public MessagerImp
{
public:
	virtual void PlaySound() {}
	virtual void DrawShape() {}
	virtual void WriteText() {}
	virtual void Connect() {}
};

class MobileMessageImp: public MessagerImp
{
public:
	virtual void PlaySound() {}
	virtual void DrawShape() {}
	virtual void WriteText() {}
	virtual void Connect() {}
};


//业务抽象

class MessageLite: public MessagerImp
{
public:
	virtual void Login(string username, string password)
	{
		messagerImp->Connect();
		//...
	}
	virtual void sendMessage(string message)
	{
		messagerImp->WriteText();
		//...
	}
	virtual void sendPicture(Image image)
	{
		messagerImp->DrawShape();
		//...
	}

};


class MessagePerfect: public MessagerImp
{
public:
	virtual void Login(string username, string password)
	{
		messagerImp->PlaySound();
		messagerImp->Connect();
		//...
	}
	virtual void sendMessage(string message)
	{
		messagerImp->PlaySound();
		messagerImp->WriteText();
		//...
	}
	virtual void sendPicture(Image image)
	{
		messagerImp->PlaySound();
		messagerImp->DrawShape();
		//...
	}

};

void Process()
{
	//运行时装配
	MessagerImp* mImp = new PCMessageImp();
	//...
}